const {createStore} = require('redux')

const initialState = {
    loading: false,
}

/**
 * 修改state
 * @param state 当前的state
 * @param action 本次需要更新的action
 * @returns 修改后的数据
 */
function reducer(state = initialState, action) {
    /*
    if (action.type === 'name') {
        return {...state, name: action.name}
    }
     */
    return {...state, [action.type]: action.name};
}

const store = createStore(reducer);

module.exports = store;